@extends('front.common.header')

@section('title',$result->name.' - 充电加油')

@section('head')
    @parent
    @stop

@section('content')
<link href="{{ asset('/css/employ/list.css') }}" rel="stylesheet" type="text/css">
<link href="{{ asset('/css/company/jobs.css') }}" rel="stylesheet" type="text/css">
<link href="{{ asset('/css/company/comdetails.css') }}" rel="stylesheet" type="text/css">
<div class="main"> 
    <div class="content">
        <div class='top-nav'>
    		<ul>
    		  {!! $mianbaoxie !!}
    		</ul>
    	</div>
    </div>
    <div class="employ-list">
        <div class="employ-list-left fl">
            <div class="employ-search mb20">
                <div class="employ-info employ-tags">
                    @if(!empty($employTags))
                    @foreach($employTags as $etags)
                    <span class="tags">{{ $etags }}</span>
                    @endforeach
                    @endif
                </div>
                <div class="employ-info employ-title mt-20">
                    {{$result->name}}
                </div>
                <div class="employ-info">
                    <div class="employ-info-ext fl">
                        <div class="user-info-avatar fl">
                            <img src="{{ userlogo($result->user_id,'middle') }}" >
                        </div>
                        <div class="user-info-uname ml-20 fl">{{$result->userinfo->name}}</div>
                        <div class="user-info-createtime ml-20 fl">{{date("Y年m月d日 H:s",strtotime($result->created_at))}}</div>
                        <div class="user-info-createtime ml-10 fl">|</div>
                        <div class="dropdown user-info-createtime ml-10 fl">
                            <form action="{{url('/reports')}}" method="POST" onsubmit="return checkParam('{{empty($authuser)?0:1}}',this)">
                                {{csrf_field()}}
                                @if($app_table=='tcourse')
                                <input type="hidden" name="app" value="teaches_content">
                                @elseif($app_table=='tcompany')
                                <input type="hidden" name="app" value="teaches_company">
                                @else
                                <input type="hidden" name="app" value="teaches">
                                @endif
                                <input type="hidden" name="app_id" value="{{$result->id}}">
                                <input type="hidden" name="app_url" value="{{Request::getRequestUri()}}">
                                <input type="hidden" name="report_type" value="1">
                                <a href="javascript:void(0)" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 举报<span class="caret"></span></a>
                                <ul class="dropdown-menu" aria-labelledby="dLabel">
                                    <li><button type="submit">个人信息举报</button></li>
                                    <li><button type="submit" onclick="$('input[name=report_type]').val(2);">垃圾信息举报</button></li>
                                </ul>
                            </form>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="employ-info-ext fl">
                        <ul class="clearfix">
                            <li class="color-orange">
                                <img src="{{ asset('/images/front/jiuyezhinan/view.png') }}" title="浏览">
                                {{$result->views_num?:0}}
    						</li>
                            <li class="color-orange">
                                <img src="{{ asset('/images/front/jiuyezhinan/pl.png') }}" title="评论">
    							{{$result->comments_num?:0}}
    						</li>
                            @if(empty($result->is_collect) || $result->is_collect == 0)
                            <li class="color-gray" id="collect_num">
                                <a href="javascript:void(0);" onclick="toCollect('/member/collect','{{$result->showtype=='teaches'?'teaches_content':'teaches_company'}}','{{$result->id}}','{{ csrf_token()}}','{{empty($authuser)?0:$authuser->id}}')">
                                    <img src="{{ asset('/images/front/heart-no.png') }}" title="收藏" >&nbsp;&nbsp;
                                </a>
                                    <span class="color-gray">{{ $result->attention_num}}</span>
                                
                            </li>
                            @else
                            <li class="color-gray" id="collect_num">
                                <img src="{{ asset('/images/front/jiuyezhinan/red-heart.png') }}" title="收藏">&nbsp;&nbsp;
                                <span>{{ $result->attention_num}}</span>
                            </li>
                            @endif
                            <li class="small">|</li>
                            <div class="bdsharebuttonbox"><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a><a href="#" class="bds_douban" data-cmd="douban" title="分享到豆瓣网"></a></div>
                            <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":["qzone","tsina","weixin","douban"],"bdPic":"","bdStyle":"1","bdSize":"24"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
                        </ul>
                    </div>
                    <div class="clearfix"></div>
                </div>
                <div class="employ-info full-screen bodertop-213 margin-top-10 jiuyezhinan">
                    <div class="full-button float-l"><a href="javascript:void(0)" id="iframe-full">全屏播放</a></div>
                    <div class="clearfix"></div>
                </div>
                <div class="employ-info flexpaper_viewer" id="documentViewer" style="width:91.6%;">
                    <iframe style="width: 100%;border: none;background: #fff;" src="{{$result->ppt->url}}" width="100%" height="446" id="iframed"></iframe>
                    
                    <script type="text/javascript">
                    $(function(){
                    	var canvas = document.getElementById('iframe-full');
                        var iframe = document.getElementById('iframed');
                        canvas.addEventListener('click', function(e) {
                        	e.preventDefault();
                        	requestFullscreen(iframe);
                        });	
                        var requestFullscreen = function(element) {  
                      	  if(element.requestFullScreen) {  
                      	    element.requestFullScreen();  
                      	  } else if(element.webkitRequestFullScreen ) {  
                      	    element.webkitRequestFullScreen();  
                      	  } else if(element.mozRequestFullScreen) {  
                      	    element.mozRequestFullScreen();  
                      	  }else if (element.msRequestFullscreen) {
                       		element.msRequestFullscreen();
                  		  }
                      	}; 
                    });
                    document.addEventListener("fullscreenchange", function () {  
              			iframe.style.height = (document.fullscreen)? "100%" : "446px";
          			}, false);
                    document.addEventListener("MSFullscreenChange", function () {  
              			if(document.msFullscreenElement||document.isMSFullscreen){
              				document.getElementById('iframed').style.height ="100%";
              			}else{
              				document.getElementById('iframed').style.height ="446px";
              			}
          			}, false);
                    document.addEventListener("mozfullscreenchange", function () {
                    	document.getElementById('iframed').style.height = (document.mozfullscreen)? "100%" : "446px";
                    }, false);

                    document.addEventListener("webkitfullscreenchange", function () {
                    	document.getElementById('iframed').style.height = (document.webkitfullscreen)? "100%" : "446px";
                    }, false);
                    </script>
                </div>
                <div class="employ-info clearfix">
                    <div class="float-l width-50 text-left prev-next">
                    @if(!empty($result->previd)) 
                    上一节：
                    <a href="javascript:void(0)" onclick="toStudy(this,'/teaches/content','{{$result->chapter->teaches->id}}','{{csrf_token()}}','{{$result->previd->id}}')">{{$result->previd->name}}</a>
                    @endif
                    </div>
                    <div class="float-r width-50 text-right prev-next">
                    @if(!empty($result->nextid)) 
                    下一节：
                    <a href="javascript:void(0)" onclick="toStudy(this,'/teaches/content','{{$result->chapter->teaches->id}}','{{csrf_token()}}','{{$result->nextid->id}}')">{{$result->nextid->name}}</a>
                    @endif
                    </div>
                </div>
            </div>
            <div id="com-comments-list">
                <h4 class="c0 pt15 pb15 pl20 ma0">全部评论</h4>
                <div id="itemContainer" >
                    @foreach($comments as $k=>$vo)
                    <div class="comment-common" id="comment-common{{$k}}">
                        <div class="comment-user-avatar fl pt10">
                            <img src="{{userlogo($vo->user_id,'middle')}}">
                        </div>
                        <div class="comment-main fl">
                            <div class="comment-content text-left">
                                <p class="font-20 c3">{{getUserName($vo->user_id)}}</p>
                                <p class="fs14 c5">{{$vo->content}}</p>
                                <div class="fs14 c9 ma0">
                                    <div class="fl">
                                        {{$vo->created_at}}&nbsp;&nbsp;&nbsp;&nbsp;
                                        <a href="javascript:;" onclick="showreply({{$vo->comment_id}})">回复</a>
                                    </div>
                                    <div class="fr mr15">
                                        <img src="{{ asset('/images/front/jiuyezhinan/pl.png') }}">
                                        @if(count($vo->childComments)>0)
                                        <input type="text" name="totalnum{{$vo->comment_id}}" value="{{count($vo->childComments)}}" readonly="readonly">
                                        @else
                                        <input type="text" name="totalnum{{$vo->comment_id}}" value="0" readonly="readonly">
                                        @endif
                                    </div>
                                    <div class="clr"></div>
                                </div>
                            </div>
                            <div id="comment-reply{{$vo->comment_id}}" class="comment-reply-form mt20 dn">
                                <div class="comment-reply-form-b">
                                    <textarea id="comment-reply-content{{$vo->comment_id}}" class="fl" placeholder="人可以走,留下你的态度"></textarea>
                                    <button type="button" id="submit{{$vo->comment_id}}" class="fr" @if(empty($authuser))onclick="loginTips()" @else onclick="tpushComment('/comment/push?typeid=5','{{$vo->comment_id}}','{{$vo->user_id}}','{{$app_table}}','{{$result->id}}','{{ csrf_token() }}')" @endif>发表回复</button>
                                </div>
                            </div>
                            <div id="message{{$vo->comment_id}}" class="commentmsg dn"></div>
                            <div class="comment-child text-left" id="comment-childs{{$vo->comment_id}}">
                                @if(count($vo->childComments)>0)
                                <div class="comment-caret-up"><i class="glyphicon glyphicon-triangle-top"></i></div>
                                <div class="comment-child-content" id="comment-child-content{{$vo->comment_id}}">
                                    @foreach($vo->childComments as $key=>$zn)
                                    @if($key<3)
                                    <div class="comment-child-content-list" >
                                        <p class="fs18 color-green">{{$zn->user->name}}：</p>
                                        <p class="fs14 c5">{{$zn->content}}</p>
                                    </div>
                                    @endif
                                    @endforeach
                                </div>
                                @endif
                            </div>
                        </div>
                        <div class="clr"></div>
                    </div>
                    @endforeach
                </div>
                {{-- 分页 --}}
                <div id="holder" @if(count($comments)== 0) class="holder dn" @else class="holder" @endif></div>
                <script>
                 jPages();
                </script>
            <div class="comment-reply-main">
                <textarea id="comment-reply-content" placeholder="人可以走,留下你的态度"></textarea>
                <div class="mb20 lh44 mt10">
                    <div id="message" class="fl"></div>
                    <button type="button" class="fr" id="submit-main" @if(empty($authuser))onclick="loginTips()" @else onclick="tcomment('/comment/push?typeid=5','{{$app_table}}','{{$result->id}}','{{ csrf_token() }}')" @endif>发表回复</button>
                </div>
            </div>
          </div>
        </div>
        <div class="employ-list-right fl">
            <div class="employ-list-tips">
	           <div class="tips-title">相关内训</div>
	         {{--  @foreach($hots_employ as $k=>$emphots)
	           <div class="tips-content @if($k>0) bodertop @endif">
	               <div class="tips-content-main">
    	               <div class="tips-content-title">{{ str_limit($emphots->title,24)}}</div>
    	               <div class="tips-content-views">阅读（ {{ $emphots->exts->reading_num }} ）</div>
	               </div>
	           </div>
	           @endforeach--}}
	       </div>
	      {{-- @foreach ($ads_img as $key => $adimg)
	       <div class="employ-list-tips mt-10">
	           <img src="{{$adimg->attachment($adimg->id)->url}}">
	       </div>
	       @endforeach--}}
        </div>
        <div class="clearfix"></div>
    </div>
</div>    
@stop

@section('footer')
    @parent
@stop